import { PageContainer } from '@ant-design/pro-layout';
import { Button } from 'antd';
import { useReducer, useState } from 'react';
import List from './mainContent/list';
import Liste from './mainContent/liste';

export default () => {
  const [pageName, setPageName] = useState<string>();
  const [componentVisibleText, setComponentVisibleText] = useReducer((state, action) => {
    console.log('action', action);
    switch (action) {
      case 'list':
        setPageName('停车场列表');
        return <List />;
      case 'liste':
        return <Liste />;
    }
    return state;
  }, 'list');
  console.log('componentVisibleText', componentVisibleText);
  return (
    <PageContainer title={pageName}>
      <Button
        onClick={() => {
          console.log('我被触发了');

          setComponentVisibleText('liste');
        }}
      >
        马了个飞飞
      </Button>
      {componentVisibleText}
    </PageContainer>
  );
};
